<template>
  <div ref="rootRef">
    <slot></slot>
  </div>
</template>

<script>
import useScroll from './use-scroll'
import { ref } from 'vue'

export default {
  name: 'Scroll',
  emits: ['scroll'],
  props: {
    // 是否可以点击
    click: {
      type: Boolean,
      default: true
    },
    // 监听派发事件的频率，默认为0不派发事件，最高为3，只要滚动就一直派发
    probeType: {
      type: Number,
      default: 0
    }
  },
  setup (props, { emit }) {
    const rootRef = ref(null)
    const scroll = useScroll(rootRef, props, emit)

    return { rootRef, scroll }
  }
}
</script>
